package com.fooddiary.service;

import com.fooddiary.model.Model;
import com.fooddiary.model.Weight;
import com.fooddiary.util.AppException;
import com.fooddiary.util.SortPaginationBean;
import com.fooddiary.web.form.WeightForm;

/**
 * Defines business logic operations for {@link Weight} entities <br>
 * @author Created by andrey.kuznetsov <br>
 * @author Last modified by $Author$ <br>
 * @author Last modified on $Date$ at revision $Revision$ <br>
 */
public interface IWeightService {

	/**
	 * Loads weight records with server-side sorting and pagination <br>
	 * @param p_model - current model; {@link Model} <br>
	 * @param p_sortPagination - bean with sorting and pagination data; {@link SortPaginationBean} <br>
	 * @return Object[] object array where:
	 * Object[0] - List<WeightForm> - list with {@link WeightForm} <br>
	 * Object[1] - total count of records; Need for pagination <br> 
	 * @throws AppException - if exception occured
	 */
	public Object[] loadRecords(Model p_model, SortPaginationBean p_sortPagination) throws AppException;
	
	
	/**
	 * Initialize edit profile form for add/edit new weight records <br>
	 * @param p_model - current model; {@link Model} <br>
	 * @param p_id -unique id of weight record <br>
	 * @return weight form; {@link WeightForm} <br>
	 * @throws AppException - if exception occured; {@link AppException} 
	 */
	public WeightForm initWeightForm(Model p_model, Integer p_id) throws AppException;
	
	/**
	 * Saves weight record to database <br>
	 * @param p_model - current model; {@link Model} <br>
	 * @param p_weightForm - {@link WeightForm} <br>
	 * @return saved weight form; {@link WeightForm} <br>
	 * @throws AppException - if exception occured; {@link AppException}
	 */
	public WeightForm saveWeightForm(Model p_model, WeightForm p_weightForm) throws AppException;
}
